package com.vogue.supplymall.shop.domain.service.impl;

import com.vogue.ssm.database.dao.BaseDao;
import com.vogue.supplymall.shop.domain.dao.ProductImgDao;
import com.vogue.supplymall.shop.domain.model.ProductImg;
import com.vogue.supplymall.shop.domain.service.ProductImgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * The type Product img service.
 *
 * @aouthor: zhangliang
 * @date: Create in 2017-12-25
 */
@Service("productImgService")
public class ProductImgServiceImpl extends BaseServiceImpl<ProductImg, Long> implements ProductImgService {

    @Resource
    private ProductImgDao productImgDao;

    public ProductImgServiceImpl(BaseDao<ProductImg, Long> baseDao) {
        super(baseDao);
    }

    @Override
    public List<ProductImg> findByProductId(Long pid) {
        return productImgDao.findById(pid);
    }

	@Override
	public ProductImg findProductImgBySP(Long syscodeId, Long productId) {
		ProductImg pi=new ProductImg();
		List<ProductImg> list=productImgDao.findProductImgBySP(syscodeId, productId);
		if(list.size()>0&&list.get(0)!=null) {
			pi=list.get(0);
		}
		 
		 return pi;
	}

	@Override
	public int delProductImgBySP(Long syscodeId, Long productId) {
		return productImgDao.delProductImgBySP(syscodeId, productId);
	}
    
}
